<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>

<h:body>
	<h3>JSF 2.2 | Upload de Arquivo Exemplo</h3>
	<!-- Form enctype should be multipart/form-data -->
	<h:form id="inputForm" enctype="multipart/form-data">

		<!-- inputFile tag para fazer o upload de arquivos -->
        Upload de Arquivo 
        <h:inputFile id="file" label="file" value="#{inputBean.part}"
			required="true" requiredMessage="Arquivo não selecionado !!">
			<!-- FileUploadValidator for file validation -->
			<f:validator validatorId="FileUploadValidator" />
		</h:inputFile>
		<h:message style="color: red" for="file" />
		<br />

		<h:commandButton id="submit" action="#{inputBean.uploadFile}"
			value="upload file" />
		<br />

		<!-- status message of file upload; rendered if message is set -->
		<h:outputText value="#{inputBean.statusMessage}"
			rendered="#{not empty inputBean.statusMessage}" />
	</h:form>
</h:body>
</html>
